<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ace="http://www.icefaces.org/icefaces/components"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
  xmlns:icecore="http://www.icefaces.org/icefaces/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    
     
	<ui:composition template="../WEB-INF/templates/template.xhtml">
	
		<ui:param name="title" value="Fact Entry System" />
        	
		<ui:define name="header">
			<ui:include src="../WEB-INF/templates/header.xhtml" /> 
		</ui:define>
		
		<ui:define name="menu">		
			<ui:include src="../WEB-INF/templates/menuLeft.xhtml" />               
		</ui:define>
		
		<ui:define name="content">
		<icecore:singleSubmit submitOnBlur="false" /> 
		<!-- 
		    <b >Fact Entry for the Month of 
		    	<ice:setEventPhase events="ValueChangeEvent" phase="UPDATE_MODEL_VALUES"> 
			    	<ice:selectOneMenu partialSubmit="true" value="#{factBean.month}"  valueChangeListener="#{factBean.selectOneChanged}">
	   						<f:selectItems value="#{selectBoxBean.monthList}" />
	 				</ice:selectOneMenu>
 				</ice:setEventPhase>
 				
 				<ice:setEventPhase events="ValueChangeEvent" phase="UPDATE_MODEL_VALUES"> 
	 				<ice:selectOneMenu partialSubmit="true" value="#{factBean.year}"  valueChangeListener="#{factBean.selectOneChanged}">
	   						<f:selectItems value="#{selectBoxBean.yearList}" />
	 				</ice:selectOneMenu>
 				</ice:setEventPhase>
 			</b> 
		    
		    <br/><br/>
	 -->
	      	<style type="text/css">
                /* Important required because row */
                
                .ui-datatable-odd {background-color:lightgray !important;}
                table{width: 100%;}
                .columnAlignCenter{ 
						text-align: center !important; 

				}
				.columnAlignLeft{ 
						text-align: left !important; 
						padding-left: 10px;

				}
				
				
            </style>
                  
  			
  			<h:messages globalOnly="true" style="color: red;" />	 
           <ace:dataTable id="factTable"
                          value="#{factBean.factData}"
                          var="fact" binding="#{table}" rendered="false" >
                          
                <ace:column id="id" headerText="ID"  styleClass="columnAlignCenter" >
                   <h:outputText id="serial" value="#{table.rowIndex+1}" />
                </ace:column>
                <ace:column id="name" headerText="Sales and Margins" styleClass="columnAlignLeft">
                    <h:outputText id="factName" value="#{fact.factName}"/>
                    <h:inputHidden id="factId" value="#{fact.factId}"/>
                </ace:column>
                <ace:column id="chassis" headerText="Actuals" style="width:400px;" styleClass="columnAlignLeft">
                  <ice:inputText id="factValue"  size="10" maxlength="30" required="true" value="#{fact.factValue}" >
                   		<f:validateLongRange  minimum="10" maximum="120"   />
                  </ice:inputText>
                  <h:panelGroup>
                      	<h:message  for="factValue" style="color:red;padding-left:5px;" showDetail="true"/>                  
                  </h:panelGroup>
                </ace:column>
                
                    
            </ace:dataTable>
            <ice:panelGroup style="height: 30px;margin-top: 20px;float:right;" rendered="false">
                 	<h:commandButton id="loginButton"  action="#{factBean.saveFacts}" actionListener="#{factBean.submit}"  value="Save" style="width:100px;height:30px;" />
            </ice:panelGroup>
            
             
            <c:forEach var="fact" items="#{factBean.factData}">
			  <c:if test="${fact.nodeType eq 3}">
			   	
			   		<h:panelGrid id="commandButtons" styleClass="headerPanel" columns="4" cellspacing="20" columnClasses="col1_leftAlign,col2,col3,col4">
                
            			<h:outputText value="${fact.factName}"/> 
        
						<c:forEach var="scenario" items="#{factBean.scenarioList}">
							<h:outputText value="${scenario.scenarioName}"/>
							</c:forEach>
					</h:panelGrid>   	 
			  </c:if>
			  
			  <c:if test="${fact.nodeType eq 5}">
			   	
			   		<h:panelGrid id="commandButtons" styleClass="dataPanel" columns="4" cellspacing="20" columnClasses="co1_rightAlign,col2,col3,col4">
                
            			<h:outputText value="${fact.factName}" /> 
        
						<c:forEach var="scenario" items="#{factBean.scenarioList}">
							<h:inputText value=""/>
							</c:forEach>
					</h:panelGrid>   	 
			  </c:if>
			  
			  <c:if test="${fact.nodeType != 3}">
			    <c:if test="${fact.nodeType != 5}">
			   	
			   		<h:panelGrid id="commandButtons" styleClass="dataPanel" columns="4" cellspacing="20" columnClasses="col1_leftAlign">
                
            			<h:outputLabel value="${fact.factName}" style="padding-left: ${fact.labelPadding}px;"/> 
        
					
					</h:panelGrid>   	 
			  </c:if>
			  </c:if>
			  
			  
			</c:forEach>

            
         
					  
           
 
     
         </ui:define>
		
		<ui:define name="footer">
	       <ui:include src="../WEB-INF/templates/footer.xhtml" /> 
		</ui:define>
		
	</ui:composition>
	
</html>